package com.jewelry.controller;

import com.jewelry.entity.OrderItemDTO;
import com.jewelry.service.OrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * ClassName: OrderItemController
 * Package: IntelliJ IDEA
 * Description:
 *
 * @Author WGH
 * @Create 2024/3/22 21:06
 * @Version 1.0
 */
@RestController
@RequestMapping("/orderItem")
public class OrderItemController {

    @Autowired
    OrderItemService orderItemService;

    //查看订单项
    @GetMapping("/findOrderItemByOrderId/{orderId}")
    public Map findAll(@PathVariable("orderId") String orderId){
        List<OrderItemDTO> orderItemDTOS = orderItemService.selectOrderItems(Long.parseLong(orderId));
        Map map = new HashMap();
        map.put("orderItems", orderItemDTOS);
        return map;
    }
}
